From c4d04f6326d8a08df38732eeea43409063341e8b Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Thu, 18 Aug 2005 19:24:42 +0000 Subject: [PATCH] Add support to xenbus_gather to scan for strings and return them in allocated memory. Signed-off-by: Christian Limpach --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index 2e9c79361d..2cfa3106d9 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -187,6 +187,7 @@ static char *join(const char *dir, const char *name) static char buffer[4096]; BUG_ON(down_trylock(&xenbus_lock) == 0); + /* XXX FIXME: might not be correct if name == "" */ BUG_ON(strlen(dir) + strlen("/") + strlen(name) + 1 > sizeof(buffer)); strcpy(buffer, dir); @@ -399,9 +400,12 @@ int xenbus_gather(const char *dir, ...) ret = PTR_ERR(p); break; } - if (sscanf(p, fmt, result) == 0) - ret = -EINVAL; - kfree(p); + if (fmt) { + if (sscanf(p, fmt, result) == 0) + ret = -EINVAL; + kfree(p); + } else + *(char **)result = p; } va_end(ap); return ret; -- 2.30.2